package com.wz.controller;

import com.wz.common.bean.PageBean;
import com.wz.common.bean.ResultBean;
import com.wz.common.controller.BaseController;
import com.wz.service.DorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/dorder")
public class DorderController extends BaseController {

	@Autowired(required = false)
	DorderService dorderService;

	@PostMapping("/insert")
	public ResultBean insert(@RequestBody Map map) {

		int rs = dorderService.insert(map);
		return rs > 0 ? success("保存成功！") : fail("保存失败！");
	}

	@PostMapping("/list")
	public ResultBean OrderList(@RequestBody Map map) {
		PageBean bean = dorderService.query(map);
		return success("订单列表", bean);
	}

	@PostMapping("/qureypl")
	public ResultBean list1(@RequestBody Map map) {
		PageBean bean = dorderService.querypl(map);
		return success("评论列表", bean);
	}

	@PostMapping("/insertpl")
	public ResultBean list2(@RequestBody Map map) {
		int rs = dorderService.insertpl(map);
		return rs > 0 ? success("评论成功！") : fail("评论失败！");
	}
}
